import React, { Component } from 'react'
import { Link, withRouter } from 'react-router-dom'
import { Layout, Menu } from 'antd';
import { appRoutes } from '../../routes'
const { Header, Content, Footer } = Layout;
class index extends Component {
  render() {
    console.log(this.props)
    return (
      <Layout className="layout">
        <Header>
          <div className="logo" >
            千锋影视
          </div>
          <Menu
            theme="dark"
            mode="horizontal"
            defaultSelectedKeys={[appRoutes[0].path]}
            style={{ lineHeight: '64px' }}
          >
            {
              appRoutes.map(route => {
                return <Menu.Item key={route.path}>
                  <Link to={route.path}>{route.title}</Link>
                </Menu.Item>
              })
            }
          </Menu>
        </Header>
        <Content>
          {this.props.children}
        </Content>
        <Footer style={{ textAlign: 'center' }}>
          Ant Design ©2016 Created by Ant UED
        </Footer>
      </Layout>
    )
  }
}

// 利用高阶组件把路由对象传递进来
export default withRouter(index)